home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / initContexts.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  16.5 KB  |  451 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  Nov 14 1996
  22. //  Author:         llm
  23. //
  24. //  Description:
  25. //      This script creates the contexts that are used to handle
  26. //        the interactions of the tools.  The tools will not work
  27. //        without these contexts.
  28. //
  29. //  Input Arguments:
  30. //      None.
  31. //
  32. //  Return Value:
  33. //      None.
  34. //
  35. //  Notes:
  36. //
  37. //        All of the tool scripts need to have these contexts
  38. //        created before the ui part can be created.
  39. //
  40. // *****************************************************************
  41. //    WARNING    WARNING    WARNING    WARNING    WARNING    WARNING  
  42. //  
  43. //    Do not rename or remove anything from here without first
  44. //    searching all scripts for references to these names!  Just
  45. //  because you put a context into the app does *not* mean that
  46. //  you know everywhere it is being used.
  47. // 
  48. // *****************************************************************
  49.  
  50.  
  51. global proc rememberCtxSettings( string $ctxName )
  52. //
  53. // This method sees if an optionVar has been defined
  54. // for the tool.  If it has, the string it contains
  55. // is evaluated to set the tool settings.  SuperContexts
  56. // should not be saved this way, since they have no
  57. // particular settings.
  58. //
  59. {
  60.     if ( `optionVar -exists $ctxName` ){
  61.         string $cmd = `optionVar -q $ctxName`;
  62.         catch( `eval($cmd)` );
  63.     } else {
  64.         // create an empty option var so that this
  65.         // will be saved.
  66.         optionVar -sv $ctxName "";
  67.     }
  68. }
  69.  
  70.  
  71. //global proc initContexts()
  72. {
  73.     //  Create Transform Tools
  74.     global string $gSelect            = "selectSuperContext";
  75.     global string $gLasso            = "lassoSelectContext";
  76.     global string $gMove            = "moveSuperContext";
  77.     global string $gRotate            = "RotateSuperContext";
  78.     global string $gScale            = "scaleSuperContext";
  79.     global string $gMoveNormal        = "MoveNormal";
  80.     global string $gTransform        = "Transform";
  81.     global string $gMoveLimits        = "MoveLimits";
  82.     global string $gRotateLimits    = "RotateLimits";
  83.     global string $gScaleLimits        = "ScaleLimits";
  84.     global string $gPropMod            = "PropMod";
  85.     global string $gshowManip        = "ShowManips";
  86.  
  87.     string $tumble                    = "tumbleContext";
  88.     string $track                    = "trackSuperContext";
  89.     string $dolly                    = "dollySuperContext";
  90.         
  91.     if (`isTrue "BaseMayaExists"`) { 
  92.         global string $gMainWindow;
  93.  
  94.         //
  95.         // Create the contexts for the select tool
  96.         //
  97.         superCtx $gSelect;
  98.  
  99.         // Attach a modeling selection context
  100.         rememberCtxSettings `selectContext nurbsSelect`;
  101.         superCtx -edit -attach nurbsSelect $gSelect;  // don't need to remember superContext settings
  102.  
  103.         // Attach a lasso pick context to the model views,
  104.         // and the texture view
  105.         //
  106.         superCtx $gLasso;
  107.         rememberCtxSettings `lassoContext SelectLasso`;
  108.         superCtx -edit -attach SelectLasso $gLasso;
  109.         rememberCtxSettings `textureLassoContext TextureLasso`;
  110.         superCtx -edit -attach TextureLasso $gLasso;
  111.         
  112.         // Attach a hypergraph selection context
  113.         //    expSelectContext expSelectContext;
  114.         //    superCtx -edit -attach expSelectContext $gSelect;
  115.  
  116.         if (`isTrue "RenderingExists"`) {
  117.             rememberCtxSettings `renderWindowSelectContext renderWindowSelectContextItem`;
  118.             superCtx -edit -attach renderWindowSelectContextItem  $gSelect;
  119.         }
  120.  
  121.         //
  122.         // Create the contexts for the move tool
  123.         //
  124.         superCtx $gMove;
  125.     
  126.         // Attach the manipulator move context
  127.         rememberCtxSettings `manipMoveContext Move`;
  128.         superCtx -edit -attach Move $gMove;
  129.     
  130.         // Create additional single channel manips
  131.         //
  132.         manipMoveContext -ah 0 manipTXContext;
  133.         manipMoveContext -ah 1 manipTYContext;
  134.         manipMoveContext -ah 2 manipTZContext;
  135.     
  136.         //
  137.         // Create the context for the move normal tool
  138.         //
  139.         rememberCtxSettings `manipMoveContext -i1 "moveNormal.xpm" -mode 3 $gMoveNormal`;
  140.     
  141.         //
  142.         // Create the contexts for the scale tool
  143.         //
  144.         superCtx $gScale;
  145.     
  146.         // Attach the manipulator scale context
  147.         rememberCtxSettings `manipScaleContext Scale`;
  148.          superCtx -edit -attach Scale $gScale ;
  149.     
  150.         // Create additional single channel manips
  151.         // for scale
  152.         //
  153.         manipScaleContext -ah 0 manipSXContext;
  154.         manipScaleContext -ah 1 manipSYContext;
  155.         manipScaleContext -ah 2 manipSZContext;
  156.     
  157.         // Create contexts for manipulators
  158.         //
  159.         superCtx $gRotate;
  160.  
  161.            rememberCtxSettings `manipRotateContext Rotate`;
  162.          superCtx -edit -attach Rotate $gRotate ;
  163.  
  164.         if (`isTrue "PolyTextureExists"`){
  165.             rememberCtxSettings `texSelectContext transformTexSelectContext`;
  166.             superCtx -edit -attach transformTexSelectContext $gSelect;
  167.  
  168.             rememberCtxSettings `texMoveContext texMoveContext`;
  169.             superCtx -edit -attach texMoveContext $gMove;
  170.  
  171.             rememberCtxSettings `texScaleContext texScaleContext`;
  172.             superCtx -edit -attach texScaleContext $gScale;
  173.     
  174.             rememberCtxSettings `texRotateContext texRotateContext`;
  175.             superCtx -edit -attach texRotateContext $gRotate;
  176.         }
  177.     
  178.         // Create additional single channel manips
  179.         // for rotate
  180.         //
  181.  
  182.         manipRotateContext -ah 0 manipRXContext;
  183.         manipRotateContext -ah 1 manipRYContext;
  184.         manipRotateContext -ah 2 manipRZContext;
  185.     
  186.            rememberCtxSettings `srtContext -i1 "srt.xpm" $gTransform`;
  187.            rememberCtxSettings `manipMoveLimitsCtx -i1 "moveLimits.xpm" $gMoveLimits`;
  188.            rememberCtxSettings `manipScaleLimitsCtx -i1 "scaleLimits.xpm" $gScaleLimits`;
  189.            rememberCtxSettings `manipRotateLimitsCtx -i1 "rotateLimits.xpm" $gRotateLimits`;
  190.         rememberCtxSettings `propModCtx -i1 "propMod.xpm" $gPropMod`;
  191.  
  192.         // Create the contexts for the showManip tool
  193.         //
  194.         superCtx $gshowManip;
  195.  
  196.         // Attach the show manipulator context
  197.         //
  198.         rememberCtxSettings `showManipCtx showManip3D`;
  199.         superCtx -edit -attach showManip3D $gshowManip;
  200.  
  201.         if (`isTrue "PolyTextureExists"`){
  202.             // Attach the texture view context
  203.             //
  204.             rememberCtxSettings `texManipContext showManipTextureContext`;
  205.             superCtx -edit -attach showManipTextureContext $gshowManip;
  206.         }
  207.  
  208.         scriptJob -permanent -parent $gMainWindow -event ToolChanged changeToolIcon;
  209.  
  210.         //    Setup the Fly Through Context.
  211.         //
  212.         source "flyThroughContextSetup.mel";
  213.  
  214.         //    Create the contexts for the Align Tool and the Snap Together Tool.
  215.         //
  216.         rememberCtxSettings `alignCtx -i1 "alignTool.xpm" alignToolCtx`;
  217.         rememberCtxSettings `snapTogetherCtx  -i1 "snapTogetherTool.xpm" snapTogetherToolCtx`;
  218.     }
  219.        
  220.        
  221.     //
  222.     //  Create Object Edit Tools
  223.     //
  224.     if (`isTrue "DeformersExists"`) { 
  225.         rememberCtxSettings `wireContext -i1 "wire.xpm" wireCtx`;
  226.         rememberCtxSettings `wrinkleContext -i1 "wrinkle.xpm" wrinkleCtx`;
  227.         rememberCtxSettings `setEditCtx -i1 "setEdit.xpm" setEditContext`;    
  228.     }
  229.  
  230.  
  231.     if (`isTrue "BaseMayaExists"`) { 
  232.         //
  233.         //  Create View Tools
  234.         //
  235.         rememberCtxSettings `tumbleCtx -ac true -lt true -i1 "tumble.xpm" $tumble`;
  236.  
  237.         rememberCtxSettings `trackCtx -ac true trackContext`;
  238.         superCtx -i1 "track.xpm" $track;
  239.         superCtx -edit -attach trackContext $track;
  240.     
  241.         rememberCtxSettings `dollyCtx -ac true -ld true dollyContext`;
  242.         superCtx -i1 "dolly.xpm" $dolly;
  243.         superCtx -edit -attach dollyContext $dolly;
  244.     
  245.         rememberCtxSettings `orbitCtx -tn "Yaw-Pitch Tool" -i1 "yawPitch.xpm" yawPitchContext`;
  246.         rememberCtxSettings `orbitCtx -lo true -tn "Azimuth Elevation Tool" -i1 "azimuthElevation.xpm" azimuthElevationContext`;
  247.         rememberCtxSettings `rollCtx -i1 "roll.xpm" rollContext`;
  248.         
  249.         rememberCtxSettings `boxZoomCtx boxZoomContext`;
  250.         superCtx -i1 "boxZoom.xpm" boxZoomSuperContext;
  251.         superCtx -edit -attach boxZoomContext boxZoomSuperContext;
  252.     }
  253.  
  254.        if (`isTrue "ExplorerExists"`) {
  255.            if (`exists view2dToolCtx`) {
  256.                rememberCtxSettings `view2dToolCtx -tr track2dContext`;
  257.                superCtx -edit -attach track2dContext $track;
  258.        
  259.                rememberCtxSettings `view2dToolCtx -do dolly2dContext`;
  260.                superCtx -edit -attach dolly2dContext $dolly;
  261.     
  262.                rememberCtxSettings `view2dToolCtx -bz boxZoom2dContext`;
  263.                superCtx -edit -attach boxZoom2dContext boxZoomSuperContext;
  264.            }
  265.     }
  266.  
  267.     if (`isTrue "AnimationUIExists"`) { 
  268.         // Attach a graph editor selection context
  269.         rememberCtxSettings `selectKeyCtx selectKeyContext`;
  270.         superCtx -edit -attach selectKeyContext $gSelect;
  271.  
  272.         // Attach a selection context for keyframe region of the dope sheet
  273.         rememberCtxSettings `keyframeRegionSelectKeyCtx keyframeRegionSelectKeyContext`;
  274.         superCtx -edit -attach keyframeRegionSelectKeyContext $gSelect;
  275.  
  276.         // Attach a graph editor move context
  277.         rememberCtxSettings `moveKeyCtx moveKeyContext`;
  278.         superCtx -edit -attach moveKeyContext $gMove;
  279.     
  280.         // Attach a move context for the keyframe region of the dope sheet
  281.         rememberCtxSettings `keyframeRegionMoveKeyCtx keyframeRegionMoveKeyContext`;
  282.         superCtx -edit -attach keyframeRegionMoveKeyContext $gMove;
  283.  
  284.         // Attach a graph editor scale context
  285.         rememberCtxSettings `scaleKeyCtx scaleKeyContext`;
  286.         superCtx -edit -attach scaleKeyContext $gScale;
  287.     
  288.         // Attach a scale context for the keyframe region of the dope sheet
  289.         rememberCtxSettings `keyframeRegionScaleKeyCtx keyframeRegionScaleKeyContext`;
  290.         superCtx -edit -attach keyframeRegionScaleKeyContext $gScale;
  291.  
  292.         //
  293.         //  Create Animation Tools
  294.         //
  295.         // global string $gConstrainedMotion = "ConstrainedMotion";
  296.     
  297.         superCtx -i1 "directKey.xpm" directKeySuperContext;
  298.         rememberCtxSettings `directKeyCtx directKeyContext`;
  299.         superCtx -edit -attach directKeyContext directKeySuperContext;
  300.         rememberCtxSettings `keyframeRegionDirectKeyCtx keyframeRegionDirectKeyContext`;
  301.         superCtx -edit -attach keyframeRegionDirectKeyContext directKeySuperContext;
  302.     
  303.         superCtx -i1 "setKeySmall.xpm" setKeySuperContext;
  304.         rememberCtxSettings `setKeyCtx setKeyContext`;
  305.         superCtx -edit -attach setKeyContext setKeySuperContext;
  306.         rememberCtxSettings `keyframeRegionSetKeyCtx keyframeRegionSetKeyContext`;
  307.         superCtx -edit -attach keyframeRegionSetKeyContext setKeySuperContext;
  308.     
  309.         superCtx -i1 "insertKeySmall.xpm" insertKeySuperContext;
  310.         rememberCtxSettings `insertKeyCtx insertKeyContext`;
  311.         superCtx -edit -attach insertKeyContext insertKeySuperContext;
  312.         rememberCtxSettings `keyframeRegionInsertKeyCtx keyframeRegionInsertKeyContext`;
  313.         superCtx -edit -attach keyframeRegionInsertKeyContext insertKeySuperContext;
  314.     
  315.         // $startTime = `playbackOptions -q -min`;
  316.         // $endTime   = `playbackOptions -q -max`;
  317.         // pathAnimationCtx -stu $startTime -etu $endTime pathAnimationContext;
  318.         // 
  319.         // markerCtx -pm 1 -om 0 markerContext;
  320.         //
  321.         // constrainedMotionCtx  $gConstrainedMotion;
  322.  
  323.         rememberCtxSettings `graphTrackCtx graphTrackContext`;
  324.         superCtx -edit -attach graphTrackContext $track;
  325.         rememberCtxSettings `keyframeRegionTrackCtx keyframeRegionTrackContext`;
  326.         superCtx -edit -attach keyframeRegionTrackContext $track;
  327.     
  328.         rememberCtxSettings `graphDollyCtx graphDollyContext`;
  329.         superCtx -edit -attach graphDollyContext $dolly;
  330.         rememberCtxSettings `keyframeRegionDollyCtx keyframeRegionDollyContext`;
  331.         superCtx -edit -attach keyframeRegionDollyContext $dolly;
  332.     }
  333.        
  334.     if (`isTrue "PolyTextureExists"`){
  335.  
  336.         // Create texture window track,dolly,zoom contexts.
  337.         //
  338.            if (`exists texWinToolCtx`) {
  339.                rememberCtxSettings `texWinToolCtx -tr tracktwContext`;
  340.                superCtx -edit -attach tracktwContext $track;
  341.        
  342.                rememberCtxSettings `texWinToolCtx -do dollytwContext`;
  343.                superCtx -edit -attach dollytwContext $dolly;
  344.     
  345.                rememberCtxSettings `texWinToolCtx -bz boxZoomtwContext`;
  346.                superCtx -edit -attach boxZoomtwContext boxZoomSuperContext;
  347.            }
  348.  
  349.         //    Create bestPlaneTexturing Context
  350.         //
  351.  
  352.         scriptCtx
  353.             -i1 "bestPlaneTxt.xpm"
  354.             -bcn "defaultTool"
  355.  
  356.             -title "Polygon Texturing Tool"
  357.             -totalSelectionSets 2
  358.             -cumulativeLists false
  359.             -expandSelectionList true
  360.             -exitUponCompletion true
  361.             -fcs ("performBestPlaneTexturing " +
  362.                   "$Selection1 $Selection2")
  363.  
  364.             -setNoSelectionPrompt "Select one or more polygonal faces to map."
  365.             -setSelectionPrompt ("Select additional polygonal faces to map " +
  366.                                  "or press ENTER to begin defining the projection plane.")
  367.             -setAutoToggleSelection true
  368.             -setAutoComplete false
  369.             -setSelectionCount 0
  370.             -pf    true
  371.             -pv    true
  372.             -cv true
  373.             -xyz true
  374.             -setNoSelectionPrompt ("Select three or more vertices/CVs/Locators " +
  375.                                    "to define the projection plane.")
  376.             -setSelectionPrompt ("Select additional vertices/CVs/Locators to define the " +
  377.                                  "projection plane or press Enter to " +
  378.                                  "compute the UVs.")
  379.             -setAutoToggleSelection true
  380.             -setAutoComplete false
  381.             -setSelectionCount 0
  382.             -pf    true
  383.             -pv    true
  384.             -cv true
  385.             -xyz true
  386.             polyBestPlaneTexturingContext;
  387.  
  388.         //
  389.         //  Create PolyEdit Tools
  390.         //
  391.            rememberCtxSettings `polyCreateFacetCtx -i1 "polyCreateFacet.xpm" polyCreateFacetContext`;
  392.         rememberCtxSettings `polyAppendFacetCtx -i1 "polyAppendFacet.xpm" polyAppendFacetContext`;
  393.         rememberCtxSettings `polySplitCtx -i1 "polySplitFacet.xpm" polySplitContext`;
  394.         rememberCtxSettings `polyMergeEdgeCtx -i1 "polyMergeEdge.xpm" polyMergeEdgeContext`;
  395.         rememberCtxSettings `polyMergeFacetCtx  -i1 "polyMergeFacet.xpm" polyMergeFacetContext`;
  396.         rememberCtxSettings `polyCutCtx -i1 "polyCut.xpm" polyCutContext`;
  397.     }
  398.        
  399.     //    Create Dynamics Tools
  400.    int $dynamicsIsLicensed = `licenseCheck -mode "edit" -type "fx"`;
  401.                     
  402.     if (`isTrue "DynamicsUIExists"`  && $dynamicsIsLicensed) {
  403.         string $dynName;
  404.         if ( !catch( $dynName = `dynParticleCtx -i1 "particle.xpm" dynParticleContext` ) ){
  405.             rememberCtxSettings $dynName;
  406.         }
  407.     }
  408.  
  409.     if (`isTrue "KinematicsExists"`) { 
  410.         //
  411.         //  Create Kinematics Tools
  412.         //
  413.         rememberCtxSettings `jointCtx -i1 "kinJoint.xpm" jointContext`;
  414.         rememberCtxSettings `ikHandleCtx -i1 "kinHandle.xpm" ikHandleContext`;
  415.         rememberCtxSettings `ikSplineHandleCtx -i1 "kinSplineHandle.xpm" ikSplineHandleContext`;
  416.         rememberCtxSettings `insertJointCtx -i1 "kinInsert.xpm" insertJointContext`;
  417.         rememberCtxSettings `createDrawCtx createDrawContext`;
  418.     }
  419.     
  420.     if (`isTrue "DimensionsExists"`) { 
  421.         //
  422.         //  Create Dimension Tools
  423.         //
  424.         rememberCtxSettings `distanceDimContext -i1 "distanceDim.xpm" distanceDimContext`;
  425.         rememberCtxSettings `paramDimContext -i1 "paramDim.xpm" paramDimContext`;
  426.         rememberCtxSettings `arcLenDimContext -i1 "arcLengthDim.xpm" arcLenDimContext`;
  427.     }
  428.        
  429.     if (`isTrue "RenderingExists"`) {
  430.         //
  431.         //  Create Rendering Tools
  432.         //
  433.         texturePlacementContext -i1 "texturePlacement.xpm" defaultTexturePlacementContext;
  434.         projectionContext -image1 "polyInteractiveTexturePlacement.xpm" shadingProjectionContext;
  435.         shadingGeometryRelCtx -onc "allListerEditorsSelectMode true"
  436.              -ofc "allListerEditorsSelectMode false"
  437.             -i1 "shadingGroupList32x32.xpm"
  438.             shadingGeometryRelContext;
  439.         shadingLightRelCtx      -onc "allListerEditorsSelectMode true"
  440.              -ofc "allListerEditorsSelectMode false"
  441.             -i1 "lightLinkList32x32.xpm"
  442.             shadingLightRelContext;
  443.     }
  444.  
  445.     if (`isTrue "MayaCreatorExists"`) {
  446.         global string $gCreatorWireCtx;
  447.         $gCreatorWireCtx = `dynWireCtx`;
  448.         rememberCtxSettings $gCreatorWireCtx;
  449.     }
  450. }
  451.